package com.design.patterns.proxy;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class MyTest3 {


    public static void main(String[] args) throws Exception {
        //
        Class<? super RedApple> superclass = RedApple.class.getSuperclass();
        Apple apple = (Apple) superclass.newInstance();
        apple.print();


        Student student = new Student();

        Constructor<? extends Student> constructor = student.getClass().getConstructor(String.class,Integer.class,String.class);
        for (Constructor<?> constructor1 : student.getClass().getConstructors()) {
            System.out.println(constructor1);
        }

        Student.class.getDeclaredFields();

//        Constructor<? extends Student> constructor = student.getClass().getConstructor();
//
//
//        Field field = student.getClass().getDeclaredField("name");
//        field.setAccessible(true);
//        System.out.println(field);
//        Object object = field.get(student);
//        System.out.println(object);
//
//        Class clazz = Class.forName("com.design.patterns.proxy.Student");
//        Class<?> clazz2 = Apple.class.getClassLoader().loadClass("com.design.patterns.proxy.Student");
//        Student st = (Student) clazz2.newInstance();
//        st.print();
//
//        for (Method method : clazz.getMethods()) {
//            System.out.println("getMethod: " + method.toString());
//        }
//
//        Method[] declaredMethods = clazz.getDeclaredMethods();
//
//        for (Method declaredMethod : declaredMethods) {
//            System.out.println("declaredMethod: " + declaredMethod.toString());
//        }
//        for (Field declaredField : clazz.getDeclaredFields()) {
//            System.out.println(declaredField.toString());
//        }
//        for (Constructor declaredConstructor : clazz.getDeclaredConstructors()) {
//            System.out.println(declaredConstructor.toString());
//        }
    }




}